function out=parse(in)


%
%       PARSE reads a directory and returns filenames in a MATLAB string.
%       [FILENAMES]=PARSE(WILDCARD) returns a padded matrix FILENAMES of
%       files corresponding to the input string WILDCARD.
%
%       Paul Maguire <maguire@neuro.azg.nl>
%       GNIP Project
%       Groningen University Hospital   
%       Netherlands


[s,w]=unix(['ls ' in]);
end_w=length(w);
errmsg=[];
lastinx=1;


[str,cnt,errmsg,firstinx]=sscanf(w,'%s',1);
out=str;
nextinx=firstinx;
lastinx=lastinx+nextinx;


while (lastinx < end_w)


[str,cnt,errmsg,nextinx]=sscanf(w(lastinx:end_w),'%s',1);
out=str2mat(out,str);
lastinx=lastinx+nextinx;
end 